using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;


namespace DataHelper.BLL
{
    public class TK_Firm
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Fullname { get; set; }
        public int Adult { get; set; }
        public int Child { get; set; }
        public int Baby { get; set; }
        public string Image { get; set; }

        #region TK_FirmSelectAll
        public static List<TK_Firm> TK_FirmSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.TK_Firm.TK_FirmSelectAll(strSearch,top,bottom,ConnectionString);
            List<TK_Firm> TK_FirmList = new List<TK_Firm>();
            while(dr.Read())
            {
                TK_Firm myTK_Firm = new TK_Firm
                {
                    ID = !dr.IsDBNull(dr.GetOrdinal("ID")) ? (int)dr["ID"] : 0,
                    Name = !dr.IsDBNull(dr.GetOrdinal("Name")) ? (string)dr["Name"] : null,
                    Fullname = !dr.IsDBNull(dr.GetOrdinal("Fullname")) ? (string)dr["Fullname"] : null,
                    Adult = !dr.IsDBNull(dr.GetOrdinal("Adult")) ? (int)dr["Adult"] : 0,
                    Child = !dr.IsDBNull(dr.GetOrdinal("Child")) ? (int)dr["Child"] : 0,
                    Baby = !dr.IsDBNull(dr.GetOrdinal("Baby")) ? (int)dr["Baby"] : 0,
                    Image = !dr.IsDBNull(dr.GetOrdinal("Image")) ? (string)dr["Image"] : null
                };
                TK_FirmList.Add(myTK_Firm);
        }
        dr.Close();
        dr.Dispose();
        return TK_FirmList;
        }
        #endregion
        #region TK_FirmSelectRow
        public static TK_Firm TK_FirmSelectRow(int ID, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.TK_Firm.TK_FirmSelectRow(ID, ConnectionString);
            TK_Firm tk_firm = null;

            if(dr.Read())
            {
                tk_firm= new TK_Firm
                {
                    ID = !dr.IsDBNull(dr.GetOrdinal("ID")) ? (int)dr["ID"] : 0,
                    Name = !dr.IsDBNull(dr.GetOrdinal("Name")) ? (string)dr["Name"] : null,
                    Fullname = !dr.IsDBNull(dr.GetOrdinal("Fullname")) ? (string)dr["Fullname"] : null,
                    Adult = !dr.IsDBNull(dr.GetOrdinal("Adult")) ? (int)dr["Adult"] : 0,
                    Child = !dr.IsDBNull(dr.GetOrdinal("Child")) ? (int)dr["Child"] : 0,
                    Baby = !dr.IsDBNull(dr.GetOrdinal("Baby")) ? (int)dr["Baby"] : 0,
                    Image = !dr.IsDBNull(dr.GetOrdinal("Image")) ? (string)dr["Image"] : null,

                };
            }
        dr.Close();
        dr.Dispose();
        return tk_firm;
        }
        #endregion
        #region TK_FirmInsertRow
        public static void TK_FirmInsertRow(int ID, string Name, string Fullname, int Adult, int Child, int Baby, string Image, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.TK_Firm.TK_FirmInsertRow(ID, Name, Fullname, Adult, Child, Baby, Image, ConnectionString);
        }
        #endregion
        #region TK_FirmUpdateRow
        public static void TK_FirmUpdateRow(int ID, string Name, string Fullname, int Adult, int Child, int Baby, string Image, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.TK_Firm.TK_FirmUpdateRow(ID, Name, Fullname, Adult, Child, Baby, Image, ConnectionString);
        }
        #endregion
        #region TK_FirmDeleteRow
        public static void TK_FirmDeleteRow(int ID, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.TK_Firm.TK_FirmDeleteRow(ID,ConnectionString);
        }
        #endregion
    }
}
